package com.example.goodog.customViews;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.view.View;

import com.example.goodog.R;

public class MailButton extends ListViewButton {

	private String MailTo;
	private String Subject;
	private String Body;
	
	public MailButton(Context c)
	{
		this(c, "", "","");
	}
	
	public MailButton(Context c, String i_MailTo)
	{
		this(c, i_MailTo, "","");
	}
	
	public MailButton(Context c, String i_MailTo, String i_Subject)
	{
		this(c, i_MailTo, i_Subject,"");
	}
	
	public MailButton(Context c, String i_MailTo, String i_Subject, String i_Body) {
		super(c,R.drawable.mail);
		
		MailTo = i_MailTo;
		Subject = i_Subject;
		Body = i_Body;

		this.setOnClickListener(new View.OnClickListener() {
            
	           @Override
	           public void onClick(View v) {
	               			 
					 Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts(
					            "mailto",MailTo, null));
					 //intent.setType("message/rfc822");
					 intent.putExtra(Intent.EXTRA_SUBJECT, Subject);
					 intent.putExtra(Intent.EXTRA_TEXT, Body);

					 ((Activity)(v.getContext())).startActivity(Intent.createChooser(intent, "Send Email"));
	           }
	       });
	}
}
